Repository navigation
fix(cli): drop the value of unsupported go test flags - #67
not-matthias merged 1 commit into
Conversation
Merging this PR will degrade performance by 15.49%3 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
52a0d05 to
0458739
Compare
[Medium impact] The change affects command-line parsing across Go runner benchmark runs. Fix unsupported flag rejection and use tracing for the added warning before merging.
|
0458739 to
f865954
Compare
0f92d26 to
b28e471
Compare
The parser warned about unsupported flags but dropped only the flag, so a separate value was collected as a package. In `go test -p 1 ./... -bench .`, `1` became a package and the run failed with `package 1 is not in std` after the benchmarks completed. Unsupported flags are now classified the way `go test` parses them. Go flags take either no value (booleans such as `-v` or `-race`) or exactly one (`-p 1`, `-p=1`), so the runner keeps both lists from cmd/go. Boolean flags drop only themselves; value flags also drop the next argument, even when it starts with `-` (`-ldflags "-s -w"`). Flags unknown to `go test`, such as custom test flags, drop the next argument unless it starts with `-`, like Go does. The run keeps going and never fails before Go is invoked. Closes COD-4005
b28e471 to
a8f4f19
Compare
TLDR: Unsupported
go testflags were dropped, but their separate value became a package:go test -p 1 ./... -bench .failed withpackage 1 is not in stdafter the benchmarks ran. The parser now knows each Go flag's arity and drops the value too.cli.rskeeps the boolean (20) and value (47) flag lists from cmd/go (Go 1.24 to 1.27).-v,-race) drop only themselves;test -v fmtkeepsfmt.-(-ldflags "-s -w").go test(custom test flags) drop the next argument unless it starts with-, like Go.log::warn!); the run never fails before Go is invoked.Review note: the flag lists need an update when Go adds
go testor build flags.Closes COD-4005